#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QGraphicsScene>
#include <QMouseEvent>
#include <QMap>
#include "scene.h"
#include "FigureContainer.h"

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();

private:
    Ui::Widget *ui;
    Scene *scene;
    FigureContainer fg;
    QMap<QGraphicsItem*, int> ptrfg;
    QVector<int> selectionFigures;

    void turnFigure(QGraphicsItem*, QPoint, double);
    QGraphicsItem* addFigureToScene(FigureType, vector<double>, pair<double, double>);
    void changeFigureToScene(FigureType, QGraphicsItem*, vector<double>, pair<double, double>);

public slots:
    void slotFillFromFile();
    void slotSaveInFile();

    void slotEnableDraw();
    void slotEnableSelect();
    void slotEnableChange();

    void slotAddNewFigure(vector<double>, QGraphicsItem*);
    void slotSelection(QList<QGraphicsItem *>);
    void slotChangeFigure(pair<double, double>);

    void slotClearScene();
};

#endif // WIDGET_H
